<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="include/base.jsp" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8" />
	<title>凯盛项目管理系统</title>
	
	<link href="${basePath }/css/bootstrap.min.css" type="text/css" rel="stylesheet"/>
	<script src="${basePath }/js/jquery-1.8.2.min.js" type="text/javascript"></script>
	<script src="${basePath }/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<body class="body">
	
	<jsp:include page="include/top.jsp"/>
			
	<div class="container">
		<div class="row">
			<div class="span9">
				<form class="form-horizontal" action="${basePath }/task/editTask" method="post">
					<fieldset>
					<legend>添加新任务</legend>
					<div class="control-group">
						<label class="control-label" for="input01">任务名称</label>
						<div class="controls">
							<input type="hidden" name="id" value="${task.id }"/>
							<input id="input01" class="span5" type="text" name="task.t_name" value="${task.t_name }"></input>
							<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="input01">开始时间</label>
						<div class="controls">
							<input id="input01" class="span5" type="text" name="task.t_start_time" value="${task.t_start_time }"></input>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="input01">截止时间</label>
						<div class="controls">
							<input id="input01" class="span5" type="text" name="task.t_end_time" value="${task.t_end_time }"></input>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="input01">任务描述</label>
						<div class="controls">
							<textarea for="input01" class="span5" rows="8" name="task.t_describle">${task.t_describle }</textarea>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="multiSelect">状态 ${task.t_stat == '进行中' ? 'selected' : '' }</label>
						<div class="controls">
							<select id="multiSelect" name="task.t_stat">
								<option selected="selected">${task.t_stat }</option>
								<option>新任务</option>
								<option>进行中</option>
								<option>已完成</option>
							</select>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="multiSelect">级别</label>
						<div class="controls">
							<input type="hidden" value="${task.t_level }" name="t_level">
							<select id="multiSelect" name="task.t_level">
								<option id="1">重要紧急</option>
								<option id="2">重要不紧急</option>
								<option id="3">紧急不重要</option>
								<option id="4">不紧急不重要</option>
							</select>
						</div>
					</div>
					<script type="text/javascript">
						var level = $("input[name=t_level]").val();
						if("重要紧急" == level){
							$("#1").attr("selected","selected");
						}else if("重要不紧急" == level){
							$("#2").attr("selected","selected");
						}else if("紧急不重要" == level){
							$("#3").attr("selected","selected");
						}else if("不紧急不重要" == level){
							$("#4").attr("selected","selected");
						}
					</script>
					<div class="control-group">
						<label class="control-label" for="multiSelect">负责人</label>
						<div class="controls">
							<select id="multiSelect" name="task.t_member">
								<option selected="selected">${task.employee.username }</option>
								<c:forEach items="${employeeList }" var="e">
									<option>${e.username }11</option>
								</c:forEach>
							</select>
						</div>
					</div>
					<div class="form-actions">
						<button class="btn btn-primary" type="submit">保存</button>
						<c:choose>
						<c:when test="${param.code != 2002 }">
							<a href="${basePath }/task/toTask?id=${sessionScope.goalId}"><input type="button" class="btn" value="返回"/></a>
						</c:when>
						<c:when test="${param.code == 2002 }">
							<a href="${basePath }/task/toAllTask"><input type="button" class="btn" value="返回"/></a>
						</c:when>						
						</c:choose>
					</div>
					</fieldset>
				</form>
			</div>
		</div>
	</div>
	
</body>
</html>
